﻿@{
    ViewBag.Title = "短信通知";
    string mobile = ViewBag.mobile;
    List<SelectListItem> groupListItems = ViewBag.groupListItems;
    groupListItems.RemoveAt(0);//移除第一项
    int smsType = ViewBag.smsType;
}
<form id="form1" class="layui-form" url="SmsSave">
    @Html.AntiForgeryToken()
    <!--导航栏-->
    <div class="pageheader">
        <div class="page-bar">
            <ul class="page-breadcrumb">
                <li><a href="javascript:;"><i class="iconfont icon-home1"></i> 首页</a> </li>
                <li><a href="../channel/site_list">会员管理</a> </li>
                <li><a href="javascript:;">短信通知</a> </li>
            </ul>
        </div>
    </div>
    <!--/导航栏-->
    <!--内容-->
    <div class="layui-fluid">
        <div class="layui-tab layui-tab-card">
            <ul class="layui-tab-title" id="floatHead">
                <li class="layui-this">批量短信通知</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label">输入类型</label>
                        <div class="layui-input-block">
                            @Html.RadioButton("rblSmsType", 1, smsType == 1, new { title = "手动输入", @lay_filter = "btnSelected" })
                            @Html.RadioButton("rblSmsType", 2, smsType == 2, new { title = "批量通知", @lay_filter = "btnSelected" })
                        </div>
                    </div>
                    <div id="smsType"></div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">模板ID</label>
                        <div class="layui-input-block">
                            @Html.TextBox("templateId", "", new { @class = "input normal", datatype = "s0-50", sucmsg = " " })
                            <span class="Validform_checktip"></span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">短信内容</label>
                        <div class="layui-input-block">
                            @Html.TextArea("txtSmsContent", "", new { @class = "input", style = "padding-left: 10px;width:98%;height:150px;", tip = "长短信按62个字符每条短信扣取", onkeydown = "checktxt(this, 'txtTip');", onkeyup = "checktxt(this, 'txtTip');" })
                            <div class="clear"></div>
                            <span id="txtTip"></span>
                            <span class="Validform_checktip">*长短信按62个字符每条短信扣取</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--/内容-->
    <!--工具栏-->
    <div class="page-footer">
        <div class="btn-wrap">
            <button class="layui-btn icon-btn" id="btnSubmit"><i class="layui-icon layui-icon-ok"></i>提交保存</button>
            <button class="layui-btn layui-btn-warm icon-btn" name="btnReturn" onclick="javascript:history.back(-1);"><i class="layui-icon layui-icon-return"></i>返回上一页</button>
        </div>
    </div>
    <!--/工具栏-->
</form>
<script type="text/html" id="Group">
    <div class="layui-form-item">
        <label class="layui-form-label">会员组别</label>
        <div class="layui-input-block">
            @foreach (var kv in groupListItems)
            {
                <input type="checkbox" name="cblGroupId_@kv.Value" value="@kv.Value" title="@kv.Text">
            }
        </div>
    </div>
</script>
<script type="text/html" id="Mobiles">
    <div class="layui-form-item">
        <label class="layui-form-label">手机号码</label>
        <div class="layui-input-block">
            @Html.TextArea("txtMobileNumbers", mobile, new { @class = "input", style = "padding-left: 10px;width:98%;height:150px;", tip = "以英文“,”逗号分隔开" })
            <span class="Validform_checktip">*手机号必须是以1开头的11位数字，多个手机号以“,”号分隔开</span>
        </div>
    </div>
</script>
@section Scripts{
    <script type="text/javascript">
        layui.use(['form', 'validform','jqueryform', 'element'], function () {
            var form = layui.form, $ = layui.jquery;

            $("#form1").initValidform('#btnSubmit', 1);
            form.on('radio(btnSelected)', function (data) {
                changeQT(data.value);
            });
            setTimeout(function () {
                changeQT(@smsType);
            }, 50);
            function changeQT(value) {
                $("#smsType").html('');
                if (value == 1) {
                    $("#smsType").html($("#Mobiles").html());
                } else {
                    $("#smsType").html($("#Group").html());
                }
                form.render();
            }
        });
    </script>
}